package com.epfly.api.promo.activity;


import com.epfly.base.vo.BaseResp;
import com.epfly.iface.promo.activity.ActivityEventService;
import com.epfly.iface.promo.activity.ActivityURL;
import com.epfly.iface.promo.activity.vo.OrderCancelEventRequest;
import com.epfly.iface.promo.activity.vo.OrderOkEventRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class ActivityEventController {

    @Resource
    private ActivityEventService activityEventService;

    @PostMapping(value = ActivityURL.ACTIVITY_ORDER_OK_EVENT)
    public ResponseEntity<BaseResp> getDiscountAmount(@Validated OrderOkEventRequest request) {
        activityEventService.orderOkEvent(request);
        return ResponseEntity.ok(BaseResp.OK);
    }

    @PostMapping(value = ActivityURL.ACTIVITY_ORDER_CANCEL_EVENT)
    public ResponseEntity<BaseResp> getDiscountAmountWithBound(@Validated OrderCancelEventRequest request) {
        activityEventService.orderCancelEvent(request);
        return ResponseEntity.ok(BaseResp.OK);
    }


}
